#ifndef FramelessWindow_H
#define FramelessWindow_H

#include <QQuickWindow>

class FramelessWindow : public QQuickWindow
{
    Q_OBJECT
    enum MousePosition {
        TOPLEFT = 1,TOP,TOPRIGHT,LEFT,RIGHT,BOTTOMLEFT,BOTTOM,BOTTOMRIGHT,NORMAL
    };

public:
    FramelessWindow(QWindow * parent = nullptr);
protected:
    void mousePressEvent(QMouseEvent* event);
    void mouseReleaseEvent(QMouseEvent* event);
    void mouseMoveEvent(QMouseEvent* event);
private:

    // 设置窗口大小和形状
    void setWindowGeometry(const QPointF &pos);
    // 设置鼠标样式
    void setCursorIcon();
    MousePosition getMousePos(const QPointF &pos);

    // 缩放边距
    int step = 8;
    // 鼠标的大概位置
    MousePosition mouse_pos = NORMAL;
    // 起始位置
    QPointF start_pos;
    // 旧位置
    QPointF old_pos;
    // 旧大小
    QSize old_size;
};

#endif // FramelessWindow_H
